import { requestClient } from './request';

// 用户管理
export function getStaffUsers(params?: Record<string, any>) {
  return requestClient.get('/staff/users', { params });
}

export function getStaffUser(id: string | number) {
  return requestClient.get(`/staff/users/${id}`);
}

export function createStaffUser(data: Record<string, any>) {
  return requestClient.post('/staff/users', data);
}

export function updateStaffUser(id: string | number, data: Record<string, any>) {
  return requestClient.put(`/staff/users/${id}`, data);
}

export function deleteStaffUser(id: string | number) {
  return requestClient.delete(`/staff/users/${id}`);
}

// 用户数据统计（按日期范围统计）
export function getStaffUserDailyCounts(params: { startDate: string; endDate: string }) {
  return requestClient.get('/staff/user-stats', { params });
}

// 店铺标品管理
export function getStaffProducts(params?: Record<string, any>) {
  return requestClient.get('/staff/products', { params });
}

export function getStaffProduct(id: string | number) {
  return requestClient.get(`/staff/products/${id}`);
}

export function createStaffProduct(data: Record<string, any>) {
  return requestClient.post('/staff/products', data);
}

export function updateStaffProduct(id: string | number, data: Record<string, any>) {
  return requestClient.put(`/staff/products/${id}`, data);
}

export function deleteStaffProduct(id: string | number) {
  return requestClient.delete(`/staff/products/${id}`);
}

export function toggleProductStatus(id: string | number, status: 'on' | 'off') {
  return requestClient.put(`/staff/products/${id}/status`, { status });
}

// 个人寄售管理
export function getStaffConsignments(params?: Record<string, any>) {
  return requestClient.get('/staff/consignments', { params });
}

export function getStaffConsignment(id: string | number) {
  return requestClient.get(`/staff/consignments/${id}`);
}

export function createStaffConsignment(data: Record<string, any>) {
  return requestClient.post('/staff/consignments', data);
}

export function updateStaffConsignment(
  id: string | number,
  data: Record<string, any>,
) {
  return requestClient.put(`/staff/consignments/${id}`, data);
}

export function deleteStaffConsignment(id: string | number) {
  return requestClient.delete(`/staff/consignments/${id}`);
}

export function toggleConsignmentStatus(id: string | number, status: 'on' | 'off') {
  return requestClient.put(`/staff/consignments/${id}/status`, { status });
}

// 广告位管理
export function getAdSlots(params?: Record<string, any>) {
  return requestClient.get('/staff/ad-slots', { params });
}

export function getAdSlot(id: string | number) {
  return requestClient.get(`/staff/ad-slots/${id}`);
}

export function createAdSlot(data: Record<string, any>) {
  return requestClient.post('/staff/ad-slots', data);
}

export function updateAdSlot(id: string | number, data: Record<string, any>) {
  return requestClient.put(`/staff/ad-slots/${id}`, data);
}

export function deleteAdSlot(id: string | number) {
  return requestClient.delete(`/staff/ad-slots/${id}`);
}

export function toggleAdSlotStatus(id: string | number, status: 'on' | 'off') {
  return requestClient.put(`/staff/ad-slots/${id}/status`, { status });
}